//
// Created by miaomiaole on 2023/3/30.
//

#ifndef CMAKECXX_STACKTEMPLATE_H
#define CMAKECXX_STACKTEMPLATE_H

template<class R, int size = 100>
class StackTemplate {

    R stack[size];

    int top;

public:
    StackTemplate() : top(0) {

    }

    void push(const R &i) {
        stack[top++] = i;
    }

    R pop() {
        return stack[--top];
    }

    int length() {
        return top;
    }
};

// 模板函数 swap
template<typename T>
void Swap(T &a, T &b) {
    T temp;
    temp = a;
    a = b;
    b = temp;
}

struct Job {
    char name[40];
    double salary;
    int floor;
};

template<>
void Swap<Job>(Job &a, Job &b);

void Swap(Job &b);

#endif //CMAKECXX_STACKTEMPLATE_H
